<!-- 根组件 -->
<template>
	<router-view v-if="isWhiteList" />
	<ContainerLayout v-else />
</template>
<script>
import config from '@/global/config'
import ContainerLayout from '@/layout/containerLayout'
export default {
  name: 'app',
  data() {
    // console.log(this.$route)
    return {}
  },
  components: { ContainerLayout },
  computed: {
    isWhiteList() {
      return ~config.whiteList.indexOf(this.$route.path)
    },
    token() {
      return this.$store.getters.token
    }
  },
  watch: {
    token() {
      this.getInfoAndMenu()
    }
  },
  async created() {
    await this.getInfoAndMenu()
  },
  methods: {
    async getInfoAndMenu() {
      if (this.token) {
        // 获取字典数据
        // await this.$store.dispatch('dict/getDict')
        // 获取路由
        await this.$store.dispatch('permission/generateRoutes')
      }
    }
  }
}
</script>
<style lang="scss">
html {
	background-color: $color-bg-theme;
}
</style>
